#include "temp.h"
float read_temp()
{
	unsigned char LSB;
	unsigned char HSB;
	unsigned int  temp;
	float temperature;
	init_ds18b20();
	Write_DS18B20(0xcc);
	Write_DS18B20(0x44);
	Delay_OneWire(200);
	init_ds18b20();
	Write_DS18B20(0xcc);
	Write_DS18B20(0xbe);
	LSB = Read_DS18B20();
	HSB = Read_DS18B20();
	temp = HSB & 0x07;
	temp = temp << 8 | LSB;
	temperature = temp * 0.0625;
	return temperature;
}